<template>
	<up-popup :show="show" mode="bottom" :round="10" @close="handleClose" @open="handleOpen">
		<view class="up-popup-continar">
			<view class="title">
				浏览记录
			</view>
			<image @click="handleClose" class="close" src="https://oss.jtmckj.com/drifbottle/icon-close.png" mode="">
			</image>
			<view class="list-continar">
				<view style="text-align: center;margin-top: 230rpx;"  v-if="retrieveList.length < 1">
					暂无记录
				</view>
				<view class="list-item" v-for="(item,index) in retrieveList" :key="index">
					<view class="left-box oneellipsis">来自<text class="colFF6A00 oneellipsis" style="width: 100rpx;">{{item.memberName}}</text>的拼桌信息
					</view>
					<view class="date-time">
						{{dayjs(item.dredgeTime).format('YYYY-MM-DD HH:mm:ss')}}
					</view>
				</view>
			</view>
		</view>
	</up-popup>
</template>

<script setup>
	import {ref} from 'vue';
	import {http} from '@/api/pzApi/http/api.js';
	import dayjs from 'dayjs';
    const globalData = uni.getStorageSync('userInfo')
	
	// 定义接受的属性
	const props = defineProps({
		show: {
			type: Boolean,
			default: false
		}
	});

	// 定义事件处理函数
	const handleClose = () => {
		emit('close');
	};

  const retrieveList = ref([])
	const handleOpen = async () => {
		emit('open');
		
		const params = {
			 "functionName": "getBootleMyDredge",
			   "orgCode":globalData.orgCode,
		 "contentData": {
		         "otherMemberCode": globalData.userCode,
		         // "pageSize": "10",
		         // "pageIndex": "1"
		     }
		}
		  try {
		     const res = await http.post('/AppMemberMallProcess', params);
			 		console.log(res,'捞取记录数据----------------------------')
		  		 if(res.opFlag == 1) {
		  			 retrieveList.value  =  res.content.rowData
		  		 }
		   } catch (error) {
		     console.error('Error:', error);
		   }
	};

	// 定义事件发射器
	const emit = defineEmits(['close', 'open']);
	
  
  // 上拉加载更多
  onReachBottom(() => {
  // 	if (dftab.value == 0) {
  // 		if (pageCount.value > pageIndex1.value) {
  // 			pageIndex1.value++
  // 			getmythrow()
  // 		} else {
  // 			uni.showToast({
  // 				title: '没有下一页数据',
  // 				//将值设置为 success 或者直接不用写icon这个参数
  // 				icon: 'success',
  // 				//显示持续时间为 2秒
  // 				duration: 2000
  // 			})
  // 		}
  // 	} else {
  //        if (pageCount2.value > pageIndex2.value) {
  //        	pageIndex2.value++
  //        	getmyaskfor()
  //        } else {
  //        	uni.showToast({
  //        		title: '没有下一页数据',
  //        		//将值设置为 success 或者直接不用写icon这个参数
  //        		icon: 'success',
  //        		//显示持续时间为 2秒
  //        		duration: 2000
  //        	})
  //        }
  
  
  
  // 	}
  });
</script>

<style scoped lang="scss">
	.up-popup-continar {
		position: relative;
		min-height: 760rpx;
	

		.title {
			text-align: center;
			font-weight: bold;
			font-size: 36rpx;
			color: #212121;
			height: 99rpx;
			line-height: 99rpx;
			border-bottom: 1rpx solid #E6E6E6;
		}

		.close {
			position: absolute;
			right: 48rpx;
			top: 32rpx;
			width: 36rpx;
			height: 36rpx;
		}

		.list-continar {
			height: 650rpx;
				overflow-y: auto;
			padding: 0 46rpx;

			.list-item {
				margin-top: 40rpx;
				display: flex;
				justify-content: space-between;

				.left-box {
					width: 374rpx;
					color: #212121;
					font-size: 26rpx;

					.colFF6A00 {
						color: #FF6A00;
					}
				}

				.date-time {
					font-weight: 500;
					font-size: 26rpx;
					color: #666666;
				}
			}
		}
	}
	
		.u-safe-bottom {
			padding-bottom:  0 !important;
		}
</style>